$(document).ready(function(){
    $('#user-coupon-id').change(function(){
        var ids = $('#cart-goods-ids').val();
        var ps = $('#cart-goods-ps-style').val(); 
        var coupon_id = $('#user-coupon-id').val();
        $.post('/flow.php', {"step": "select_new_address","ids": ids,"ps_style": ps,"coupon_id": coupon_id}, function(data,status) {
            var html_total = data.amount_formated;
            var html_details;
            html_details = '<p>结算</p><li><span class="a">商品合计<span class="price">' + data.goods_price + '</span></span></li>';
            if (data.tax != "\uffe50.00") {
                html_details += '<li><span class="a">税费<span class="price" id="total-tax">' + data.tax + '</span></span></li>';
            }
            if (data.formated_shipping_fee != "\uffe50.00") {
                html_details += '<li><span class="a">配送费用<span class="price" id="shipping-fee">' + data.formated_shipping_fee + '</span></span></li>';
            }
            if (data.face_value_formated != "\uffe50.00") {
                html_details += '<li><span class="a">优惠券<span class="price" id="coupon-fee">' + data.face_value_formated + '</span></span></li>';
            }
            $('#total-info').html(html_details);
            $('#total-fee').html(html_total);
            // alert(data); 
        },'json');
    });
});